/**
 *  @param text 弹框文案 必传
 *  @param duration 显示时长 可选
 *  @param type Icon类型 成功 失败 提示
 */
function Toast( text) {
  const node = document.getElementById('jd-toast');
  if (node) document.body.removeChild(node);
  const m = document.createElement('div');
  const toastId = Date.now() + '';
  m.setAttribute('toastId', toastId);
  m.setAttribute('style', 'background: #000;border-radius: 8px;color: #fff;font-size: 28px;left: 50%;max-width: 62.6%;opacity: 0.7;padding: 0 5px;padding: 0.75rem 1rem;position: fixed;text-align: center;top: 50%;transform: translate(-50%, -50%);z-index: 9999999999;');
  m.className = 'Toast';
  m.id = 'jd-toast';
  m.innerHTML = `<div><p>${text}</p><div>`;
  document.body.appendChild(m);
  setTimeout(function() {
      const d = 0.5;
      m.style.webkitTransition =
          '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
      m.style.opacity = '0';
      setTimeout(function() {
          const node1 = document.getElementById('jd-toast');
          if (node1?.getAttribute('toastId') == toastId)
              document.body.removeChild(node1);
      }, d * 1000);
  }, duration || 2000);
}